﻿@page
@using SXFramWork.Web
@{
    ViewData["Title"] = "系统配置";
    Layout = AdminLayout.Pjax(HttpContext);
}

<div id="container">
    <style>
        .layui-field-title i {
            margin-right: 5px;
            font-size: 25px;
            position: relative;
            top: 2px;
        }

        .layui-form-item {
            width: 60%;
        }
        .layui-col-220 {
            width: 280px;
        }

        .right-col-body {
            left: 0px;
        }
       
    </style>
    <div id="app">
       
        <div class="right-col-body">
            <form class="layui-form form-cus" action="" style="padding:5px 15px;">
                <div class="layui-tab" lay-filter="docDemoTabBrief">
                    <ul class="layui-tab-title">
                        <li class="layui-this">基本信息</li>
                        <li>公司信息</li>
                    </ul>
                    <div class="layui-tab-content">
                        <div class="layui-tab-item layui-show">
                            <div class="layui-form-item">
                                <label class="layui-form-label">系统名称</label>
                                <div class="layui-input-block">
                                    <input type="text" v-model="m.siteName"   autocomplete="off" placeholder="请输入站点名称" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">站点域名</label>
                                <div class="layui-input-block">
                                    <input type="text"  v-model="m.siteUrl"  autocomplete="off" placeholder="请输入站点域名" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">站点Logo</label>
                                <div class="layui-input-block fyt-upfile">
                                    <input type="text" id="Logo"  autocomplete="off" placeholder="请选择文件" class="layui-input">
                                    <button type="button" class="layui-btn fyt-cloud" data-text="SiteLogo" data-type="sign">选择文件</button>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">版权信息</label>
                                <div class="layui-input-block">
                                    <textarea  v-model="m.copyright" class="layui-textarea" style="min-height: 60px;" placeholder="版权信息或者备案号信息，支持Html"></textarea>
                                </div>
                            </div>

                        </div>
                        <div class="layui-tab-item">
                            <div class="layui-form-item">
                                <label class="layui-form-label">公司电话</label>
                                <div class="layui-input-block">
                                    <input type="text" v-model="m.phone" autocomplete="off" placeholder="（选填）公司电话" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">公司传真</label>
                                <div class="layui-input-block">
                                    <input type="text"  v-model="m.fax" autocomplete="off" placeholder="（选填）公司传真" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">联系邮箱</label>
                                <div class="layui-input-block">
                                    <input type="text" v-model="m.email" autocomplete="off" placeholder="（选填）联系邮箱" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">联系地址</label>
                                <div class="layui-input-block">
                                    <input type="text"  v-model="m.adress" autocomplete="off" placeholder="（选填）联系地址" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">客服QQ</label>
                                <div class="layui-input-block">
                                    <input type="text" v-model="m.qq" autocomplete="off" placeholder="（选填）客服QQ" class="layui-input">
                                </div>
                            </div>
                          
                        </div>
                        
                    </div>
                </div>

                <div class="layui-form-item">

                    <div class="layui-input-block">
                        <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="submit">保　存</button>
                    </div>

                </div>
              
            </form>
        </div>
    </div>
    <script>
        var vm = new Vue({
            el: '#app',
            data: {
                m: {}
            }
        });
        layui.use(['layer', 'jquery', 'common', 'form'], function () {
            var form = layui.form; os = layui.common; $ = layui.$;

            os.cloudFile();

            var fun = {
                init(){
                    os.ajax('api/admin/sysconfig/query',{ },function (res) {
                            if (res.code == 1) {
                                vm.m = res.data;
                                $('#Logo').val(res.data.logo);
                            } 
                        }, 'get');
                }
            }
            fun.init();
            //监听提交
            form.on('submit(submit)', function (data) {
                var urls = "api/admin/sysconfig/add";
                vm.m.logo = $('#Logo').val();
                os.ajax(urls, vm.m, function (res) {
                    if (res.code == 1) {
                        os.success('保存成功');
                    }
                    else {
                        os.error(res.msg);
                    }
                });
                return false;
            });
        });
    </script>
</div>
